3.55 \(\int \frac{(c+d x)^2}{a+b \tan (e+f x)} \, dx\)

Optimal. Leaf size=181 \[ -\frac{i b d (c+d x) \text{PolyLog}\left (2,-\frac{\left (a^2+b^2\right ) e^{2 i (e+f x)}}{(a+i b)^2}\right )}{f^2 \left (a^2+b^2\right )}+\frac{b d^2 \text{PolyLog}\left (3,-\frac{\left (a^2+b^2\right ) e^{2 i (e+f x)}}{(a+i b)^2}\right )}{2 f^3 \left (a^2+b^2\right )}+\frac{b (c+d x)^2 \log \left (1+\frac{\left (a^2+b^2\right ) e^{2 i (e+f x)}}{(a+i b)^2}\right )}{f \left (a^2+b^2\right )}+\frac{(c+d x)^3}{3 d (a+i b)} \]

[Out]

(c + d*x)^3/(3*(a + I*b)*d) + (b*(c + d*x)^2*Log[1 + ((a^2 + b^2)*E^((2*I)*(e + f*x)))/(a + I*b)^2])/((a^2 + b
^2)*f) - (I*b*d*(c + d*x)*PolyLog[2, -(((a^2 + b^2)*E^((2*I)*(e + f*x)))/(a + I*b)^2)])/((a^2 + b^2)*f^2) + (b
*d^2*PolyLog[3, -(((a^2 + b^2)*E^((2*I)*(e + f*x)))/(a + I*b)^2)])/(2*(a^2 + b^2)*f^3)

________________________________________________________________________________________

Rubi [A]  time = 0.272361, antiderivative size = 181, normalized size of antiderivative = 1., number of steps used = 5, number of rules used = 5, integrand size = 20, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.25, Rules used = {3732, 2190, 2531, 2282, 6589} \[ -\frac{i b d (c+d x) \text{Li}_2\left (-\frac{\left (a^2+b^2\right ) e^{2 i (e+f x)}}{(a+i b)^2}\right )}{f^2 \left (a^2+b^2\right )}+\frac{b (c+d x)^2 \log \left (1+\frac{\left (a^2+b^2\right ) e^{2 i (e+f x)}}{(a+i b)^2}\right )}{f \left (a^2+b^2\right )}+\frac{b d^2 \text{Li}_3\left (-\frac{\left (a^2+b^2\right ) e^{2 i (e+f x)}}{(a+i b)^2}\right )}{2 f^3 \left (a^2+b^2\right )}+\frac{(c+d x)^3}{3 d (a+i b)} \]

Antiderivative was successfully verified.

[In]

Int[(c + d*x)^2/(a + b*Tan[e + f*x]),x]

[Out]

(c + d*x)^3/(3*(a + I*b)*d) + (b*(c + d*x)^2*Log[1 + ((a^2 + b^2)*E^((2*I)*(e + f*x)))/(a + I*b)^2])/((a^2 + b
^2)*f) - (I*b*d*(c + d*x)*PolyLog[2, -(((a^2 + b^2)*E^((2*I)*(e + f*x)))/(a + I*b)^2)])/((a^2 + b^2)*f^2) + (b
*d^2*PolyLog[3, -(((a^2 + b^2)*E^((2*I)*(e + f*x)))/(a + I*b)^2)])/(2*(a^2 + b^2)*f^3)

Rule 3732

Int[((c_.) + (d_.)*(x_))^(m_.)/((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[(c + d*x)^(m + 1)/(d*
(m + 1)*(a + I*b)), x] + Dist[2*I*b, Int[((c + d*x)^m*E^Simp[2*I*(e + f*x), x])/((a + I*b)^2 + (a^2 + b^2)*E^S
imp[2*I*(e + f*x), x]), x], x] /; FreeQ[{a, b, c, d, e, f}, x] && NeQ[a^2 + b^2, 0] && IGtQ[m, 0]

Rule 2190

Int[(((F_)^((g_.)*((e_.) + (f_.)*(x_))))^(n_.)*((c_.) + (d_.)*(x_))^(m_.))/((a_) + (b_.)*((F_)^((g_.)*((e_.) +
 (f_.)*(x_))))^(n_.)), x_Symbol] :> Simp[((c + d*x)^m*Log[1 + (b*(F^(g*(e + f*x)))^n)/a])/(b*f*g*n*Log[F]), x]
 - Dist[(d*m)/(b*f*g*n*Log[F]), Int[(c + d*x)^(m - 1)*Log[1 + (b*(F^(g*(e + f*x)))^n)/a], x], x] /; FreeQ[{F,
a, b, c, d, e, f, g, n}, x] && IGtQ[m, 0]

Rule 2531

Int[Log[1 + (e_.)*((F_)^((c_.)*((a_.) + (b_.)*(x_))))^(n_.)]*((f_.) + (g_.)*(x_))^(m_.), x_Symbol] :> -Simp[((
f + g*x)^m*PolyLog[2, -(e*(F^(c*(a + b*x)))^n)])/(b*c*n*Log[F]), x] + Dist[(g*m)/(b*c*n*Log[F]), Int[(f + g*x)
^(m - 1)*PolyLog[2, -(e*(F^(c*(a + b*x)))^n)], x], x] /; FreeQ[{F, a, b, c, e, f, g, n}, x] && GtQ[m, 0]

Rule 2282

Int[u_, x_Symbol] :> With[{v = FunctionOfExponential[u, x]}, Dist[v/D[v, x], Subst[Int[FunctionOfExponentialFu
nction[u, x]/x, x], x, v], x]] /; FunctionOfExponentialQ[u, x] &&  !MatchQ[u, (w_)*((a_.)*(v_)^(n_))^(m_) /; F
reeQ[{a, m, n}, x] && IntegerQ[m*n]] &&  !MatchQ[u, E^((c_.)*((a_.) + (b_.)*x))*(F_)[v_] /; FreeQ[{a, b, c}, x
] && InverseFunctionQ[F[x]]]

Rule 6589

Int[PolyLog[n_, (c_.)*((a_.) + (b_.)*(x_))^(p_.)]/((d_.) + (e_.)*(x_)), x_Symbol] :> Simp[PolyLog[n + 1, c*(a
+ b*x)^p]/(e*p), x] /; FreeQ[{a, b, c, d, e, n, p}, x] && EqQ[b*d, a*e]

Rubi steps

\begin{align*} \int \frac{(c+d x)^2}{a+b \tan (e+f x)} \, dx &=\frac{(c+d x)^3}{3 (a+i b) d}+(2 i b) \int \frac{e^{2 i (e+f x)} (c+d x)^2}{(a+i b)^2+\left (a^2+b^2\right ) e^{2 i (e+f x)}} \, dx\\ &=\frac{(c+d x)^3}{3 (a+i b) d}+\frac{b (c+d x)^2 \log \left (1+\frac{\left (a^2+b^2\right ) e^{2 i (e+f x)}}{(a+i b)^2}\right )}{\left (a^2+b^2\right ) f}-\frac{(2 b d) \int (c+d x) \log \left (1+\frac{\left (a^2+b^2\right ) e^{2 i (e+f x)}}{(a+i b)^2}\right ) \, dx}{\left (a^2+b^2\right ) f}\\ &=\frac{(c+d x)^3}{3 (a+i b) d}+\frac{b (c+d x)^2 \log \left (1+\frac{\left (a^2+b^2\right ) e^{2 i (e+f x)}}{(a+i b)^2}\right )}{\left (a^2+b^2\right ) f}-\frac{i b d (c+d x) \text{Li}_2\left (-\frac{\left (a^2+b^2\right ) e^{2 i (e+f x)}}{(a+i b)^2}\right )}{\left (a^2+b^2\right ) f^2}+\frac{\left (i b d^2\right ) \int \text{Li}_2\left (-\frac{\left (a^2+b^2\right ) e^{2 i (e+f x)}}{(a+i b)^2}\right ) \, dx}{\left (a^2+b^2\right ) f^2}\\ &=\frac{(c+d x)^3}{3 (a+i b) d}+\frac{b (c+d x)^2 \log \left (1+\frac{\left (a^2+b^2\right ) e^{2 i (e+f x)}}{(a+i b)^2}\right )}{\left (a^2+b^2\right ) f}-\frac{i b d (c+d x) \text{Li}_2\left (-\frac{\left (a^2+b^2\right ) e^{2 i (e+f x)}}{(a+i b)^2}\right )}{\left (a^2+b^2\right ) f^2}+\frac{\left (b d^2\right ) \operatorname{Subst}\left (\int \frac{\text{Li}_2\left (-\frac{\left (a^2+b^2\right ) x}{(a+i b)^2}\right )}{x} \, dx,x,e^{2 i (e+f x)}\right )}{2 \left (a^2+b^2\right ) f^3}\\ &=\frac{(c+d x)^3}{3 (a+i b) d}+\frac{b (c+d x)^2 \log \left (1+\frac{\left (a^2+b^2\right ) e^{2 i (e+f x)}}{(a+i b)^2}\right )}{\left (a^2+b^2\right ) f}-\frac{i b d (c+d x) \text{Li}_2\left (-\frac{\left (a^2+b^2\right ) e^{2 i (e+f x)}}{(a+i b)^2}\right )}{\left (a^2+b^2\right ) f^2}+\frac{b d^2 \text{Li}_3\left (-\frac{\left (a^2+b^2\right ) e^{2 i (e+f x)}}{(a+i b)^2}\right )}{2 \left (a^2+b^2\right ) f^3}\\ \end{align*}

Mathematica [A]  time = 1.41231, size = 236, normalized size = 1.3 \[ \frac{x \cos (e) \left (3 c^2+3 c d x+d^2 x^2\right )}{3 (a \cos (e)+b \sin (e))}+\frac{1}{6} b \left (\frac{3 d \left (2 i f (c+d x) \text{PolyLog}\left (2,\frac{(-a-i b) e^{-2 i (e+f x)}}{a-i b}\right )+d \text{PolyLog}\left (3,\frac{(-a-i b) e^{-2 i (e+f x)}}{a-i b}\right )\right )}{f^3 \left (a^2+b^2\right )}+\frac{6 (c+d x)^2 \log \left (1+\frac{(a+i b) e^{-2 i (e+f x)}}{a-i b}\right )}{f \left (a^2+b^2\right )}-\frac{4 (c+d x)^3}{d (b+i a) \left (a \left (1+e^{2 i e}\right )-i b \left (-1+e^{2 i e}\right )\right )}\right ) \]

Antiderivative was successfully verified.

[In]

Integrate[(c + d*x)^2/(a + b*Tan[e + f*x]),x]

[Out]

(b*((-4*(c + d*x)^3)/((I*a + b)*d*((-I)*b*(-1 + E^((2*I)*e)) + a*(1 + E^((2*I)*e)))) + (6*(c + d*x)^2*Log[1 +
(a + I*b)/((a - I*b)*E^((2*I)*(e + f*x)))])/((a^2 + b^2)*f) + (3*d*((2*I)*f*(c + d*x)*PolyLog[2, (-a - I*b)/((
a - I*b)*E^((2*I)*(e + f*x)))] + d*PolyLog[3, (-a - I*b)/((a - I*b)*E^((2*I)*(e + f*x)))]))/((a^2 + b^2)*f^3))
)/6 + (x*(3*c^2 + 3*c*d*x + d^2*x^2)*Cos[e])/(3*(a*Cos[e] + b*Sin[e]))

________________________________________________________________________________________

Maple [B]  time = 0.179, size = 922, normalized size = 5.1 \begin{align*} \text{result too large to display} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((d*x+c)^2/(a+b*tan(f*x+e)),x)

[Out]

-1/3/(I*b-a)*d^2*x^3-1/(I*b-a)*c*d*x^2-1/(I*b-a)*c^2*x-2/3*b/(I*a+b)*d^2/(-I*b-a)*x^3+2*b/(I*a+b)/f^2*d^2/(-I*
b-a)*e^2*x+4/3*b/(I*a+b)/f^3*d^2/(-I*b-a)*e^3-1/2*I*b/(I*a+b)/f^3*d^2/(-I*b-a)*polylog(3,(a-I*b)*exp(2*I*(f*x+
e))/(-I*b-a))+I*b/(I*a+b)/f^3*d^2*e^2/(a+I*b)*ln(I*exp(2*I*(f*x+e))*b-a*exp(2*I*(f*x+e))-I*b-a)-I*b/(I*a+b)/f*
d^2/(-I*b-a)*ln(1-(a-I*b)*exp(2*I*(f*x+e))/(-I*b-a))*x^2-2*I*b/(I*a+b)/f^2*c*d/(-I*b-a)*ln(1-(a-I*b)*exp(2*I*(
f*x+e))/(-I*b-a))*e+I*b/(I*a+b)/f^3*d^2*e^2/(-I*b-a)*ln(1-(a-I*b)*exp(2*I*(f*x+e))/(-I*b-a))+4*I*b/(I*a+b)/f^2
*c*d*e/(a+I*b)*ln(exp(I*(f*x+e)))-b/(I*a+b)/f^2*d^2/(-I*b-a)*polylog(2,(a-I*b)*exp(2*I*(f*x+e))/(-I*b-a))*x-2*
I*b/(I*a+b)/f*c*d/(-I*b-a)*ln(1-(a-I*b)*exp(2*I*(f*x+e))/(-I*b-a))*x-2*I*b/(I*a+b)/f^3*d^2*e^2/(a+I*b)*ln(exp(
I*(f*x+e)))-2*I*b/(I*a+b)/f^2*c*d*e/(a+I*b)*ln(I*exp(2*I*(f*x+e))*b-a*exp(2*I*(f*x+e))-I*b-a)+I*b/(I*a+b)/f*c^
2/(a+I*b)*ln(I*exp(2*I*(f*x+e))*b-a*exp(2*I*(f*x+e))-I*b-a)-2*I*b/(I*a+b)/f*c^2/(a+I*b)*ln(exp(I*(f*x+e)))-2*b
/(I*a+b)*c*d/(-I*b-a)*x^2-4*b/(I*a+b)/f*c*d/(-I*b-a)*e*x-2*b/(I*a+b)/f^2*c*d/(-I*b-a)*e^2-b/(I*a+b)/f^2*c*d/(-
I*b-a)*polylog(2,(a-I*b)*exp(2*I*(f*x+e))/(-I*b-a))

________________________________________________________________________________________

Maxima [B]  time = 2.35611, size = 961, normalized size = 5.31 \begin{align*} \text{result too large to display} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((d*x+c)^2/(a+b*tan(f*x+e)),x, algorithm="maxima")

[Out]

-1/6*(6*c*d*e*(2*(f*x + e)*a/((a^2 + b^2)*f) + 2*b*log(b*tan(f*x + e) + a)/((a^2 + b^2)*f) - b*log(tan(f*x + e
)^2 + 1)/((a^2 + b^2)*f)) - 3*(2*(f*x + e)*a/(a^2 + b^2) + 2*b*log(b*tan(f*x + e) + a)/(a^2 + b^2) - b*log(tan
(f*x + e)^2 + 1)/(a^2 + b^2))*c^2 - (2*(f*x + e)^3*(a - I*b)*d^2 + 6*(f*x + e)*(a - I*b)*d^2*e^2 + 6*I*b*d^2*e
^2*arctan2(-b*cos(2*f*x + 2*e) + a*sin(2*f*x + 2*e) + b, a*cos(2*f*x + 2*e) + b*sin(2*f*x + 2*e) + a) + 3*b*d^
2*e^2*log((a^2 + b^2)*cos(2*f*x + 2*e)^2 + 4*a*b*sin(2*f*x + 2*e) + (a^2 + b^2)*sin(2*f*x + 2*e)^2 + a^2 + b^2
 + 2*(a^2 - b^2)*cos(2*f*x + 2*e)) + 3*b*d^2*polylog(3, (I*a + b)*e^(2*I*f*x + 2*I*e)/(-I*a + b)) - 6*((a - I*
b)*d^2*e - (a - I*b)*c*d*f)*(f*x + e)^2 + (-6*I*(f*x + e)^2*b*d^2 + (12*I*b*d^2*e - 12*I*b*c*d*f)*(f*x + e))*a
rctan2((2*a*b*cos(2*f*x + 2*e) - (a^2 - b^2)*sin(2*f*x + 2*e))/(a^2 + b^2), (2*a*b*sin(2*f*x + 2*e) + a^2 + b^
2 + (a^2 - b^2)*cos(2*f*x + 2*e))/(a^2 + b^2)) + (-6*I*(f*x + e)*b*d^2 + 6*I*b*d^2*e - 6*I*b*c*d*f)*dilog((I*a
 + b)*e^(2*I*f*x + 2*I*e)/(-I*a + b)) + 3*((f*x + e)^2*b*d^2 - 2*(b*d^2*e - b*c*d*f)*(f*x + e))*log(((a^2 + b^
2)*cos(2*f*x + 2*e)^2 + 4*a*b*sin(2*f*x + 2*e) + (a^2 + b^2)*sin(2*f*x + 2*e)^2 + a^2 + b^2 + 2*(a^2 - b^2)*co
s(2*f*x + 2*e))/(a^2 + b^2)))/((a^2 + b^2)*f^2))/f

________________________________________________________________________________________

Fricas [C]  time = 1.85247, size = 1993, normalized size = 11.01 \begin{align*} \text{result too large to display} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((d*x+c)^2/(a+b*tan(f*x+e)),x, algorithm="fricas")

[Out]

1/12*(4*a*d^2*f^3*x^3 + 12*a*c*d*f^3*x^2 + 12*a*c^2*f^3*x + 3*b*d^2*polylog(3, ((a^2 + 2*I*a*b - b^2)*tan(f*x
+ e)^2 - a^2 - 2*I*a*b + b^2 + (2*I*a^2 - 4*a*b - 2*I*b^2)*tan(f*x + e))/((a^2 + b^2)*tan(f*x + e)^2 + a^2 + b
^2)) + 3*b*d^2*polylog(3, ((a^2 - 2*I*a*b - b^2)*tan(f*x + e)^2 - a^2 + 2*I*a*b + b^2 + (-2*I*a^2 - 4*a*b + 2*
I*b^2)*tan(f*x + e))/((a^2 + b^2)*tan(f*x + e)^2 + a^2 + b^2)) + (-6*I*b*d^2*f*x - 6*I*b*c*d*f)*dilog(-((2*I*a
*b + 2*b^2)*tan(f*x + e)^2 + 2*a^2 - 2*I*a*b + (2*I*a^2 + 4*a*b - 2*I*b^2)*tan(f*x + e))/((a^2 + b^2)*tan(f*x
+ e)^2 + a^2 + b^2) + 1) + (6*I*b*d^2*f*x + 6*I*b*c*d*f)*dilog(-((-2*I*a*b + 2*b^2)*tan(f*x + e)^2 + 2*a^2 + 2
*I*a*b + (-2*I*a^2 + 4*a*b + 2*I*b^2)*tan(f*x + e))/((a^2 + b^2)*tan(f*x + e)^2 + a^2 + b^2) + 1) + 6*(b*d^2*f
^2*x^2 + 2*b*c*d*f^2*x - b*d^2*e^2 + 2*b*c*d*e*f)*log(((2*I*a*b + 2*b^2)*tan(f*x + e)^2 + 2*a^2 - 2*I*a*b + (2
*I*a^2 + 4*a*b - 2*I*b^2)*tan(f*x + e))/((a^2 + b^2)*tan(f*x + e)^2 + a^2 + b^2)) + 6*(b*d^2*f^2*x^2 + 2*b*c*d
*f^2*x - b*d^2*e^2 + 2*b*c*d*e*f)*log(((-2*I*a*b + 2*b^2)*tan(f*x + e)^2 + 2*a^2 + 2*I*a*b + (-2*I*a^2 + 4*a*b
 + 2*I*b^2)*tan(f*x + e))/((a^2 + b^2)*tan(f*x + e)^2 + a^2 + b^2)) + 6*(b*d^2*e^2 - 2*b*c*d*e*f + b*c^2*f^2)*
log(((I*a*b + b^2)*tan(f*x + e)^2 - a^2 + I*a*b + (I*a^2 + I*b^2)*tan(f*x + e))/(tan(f*x + e)^2 + 1)) + 6*(b*d
^2*e^2 - 2*b*c*d*e*f + b*c^2*f^2)*log(((I*a*b - b^2)*tan(f*x + e)^2 + a^2 + I*a*b + (I*a^2 + I*b^2)*tan(f*x +
e))/(tan(f*x + e)^2 + 1)))/((a^2 + b^2)*f^3)

________________________________________________________________________________________

Sympy [F]  time = 0., size = 0, normalized size = 0. \begin{align*} \int \frac{\left (c + d x\right )^{2}}{a + b \tan{\left (e + f x \right )}}\, dx \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((d*x+c)**2/(a+b*tan(f*x+e)),x)

[Out]

Integral((c + d*x)**2/(a + b*tan(e + f*x)), x)

________________________________________________________________________________________

Giac [F]  time = 0., size = 0, normalized size = 0. \begin{align*} \int \frac{{\left (d x + c\right )}^{2}}{b \tan \left (f x + e\right ) + a}\,{d x} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((d*x+c)^2/(a+b*tan(f*x+e)),x, algorithm="giac")

[Out]

integrate((d*x + c)^2/(b*tan(f*x + e) + a), x)